package com.heima.feigns;

import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.WemediaFeignFallback;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.NewsAuthDto;
import com.heima.model.wemedia.pojos.WmNews;
import com.heima.model.wemedia.pojos.WmUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(
        value = "leadnews-wemedia",
        fallbackFactory = WemediaFeignFallback.class,
        configuration = HeimaFeignAutoConfiguration.class
)
public interface WemediaFeign {
    @PostMapping("/api/v1/user/save")
    ResponseResult<WmUser> insert(@RequestBody WmUser wmUser);

    @GetMapping("/api/v1/user/findByName/{name}")
    ResponseResult<WmUser> findByName(@PathVariable("name") String name);

    @GetMapping("/api/v1/user/one/{id}")
    ResponseResult findById(@PathVariable Integer id);

    @GetMapping("/api/v1/news/findOne/{id}")
    ResponseResult<WmNews> findWmUserById(@PathVariable("id") Integer id);

    @PutMapping("/api/v1/news/update")
    ResponseResult updateWmNews(@RequestBody WmNews wmNews);


    @GetMapping("/api/v1/news/findRelease")
    ResponseResult<List<Integer>> findRelease();

    @PostMapping("/api/v1/news/list_vo")
    ResponseResult findNewsList(@RequestBody NewsAuthDto newsAuthDto);

    @PostMapping("/api/v1/news/auth_pass")
    ResponseResult authPass(@RequestBody NewsAuthDto dto);

    @PostMapping("/api/v1/news/auth_fail")
    ResponseResult authFail(@RequestBody NewsAuthDto dto);

}

